package com.nuo.image.controller;

import com.nuo.image.po.AddOrPutPO;
import com.nuo.image.po.UrlPO;
import com.nuo.image.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


/**
 * @description: TODO
 * @author nuo
 * @date 2023/2/16 18:05
 * @version 1.0
 */
@RestController
@RequestMapping("/image")
public class ImageController {

    @Autowired
    private ImageService imageService;

    @RequestMapping("/token")
    public String getToken() {
        return imageService.getToken();
    }

    @RequestMapping("/checkToken")
    public String getCheckToken() {
        return imageService.getCheckToken();
    }

    @PostMapping("/getInfoByUrl")
    public Object getInfoByUrl(@RequestBody UrlPO po) {
        return imageService.getInfoByUrl(po);
    }

    @PostMapping("/getInfoByFile")
    public Object getInfoByFile(@RequestParam("image") MultipartFile image) {
        return imageService.getInfoByFile(image);
    }

    @PostMapping("/add")
    public Object add(@RequestBody AddOrPutPO po) {
        return imageService.add(po);
    }

    @PostMapping("/del")
    public Object del(@RequestBody UrlPO po) {
        return imageService.del(po);
    }

    @PostMapping("/put")
    public Object put(@RequestBody AddOrPutPO po) {
        return imageService.put(po);
    }

    @PostMapping("/getCheckInfoByUrl")
    public Object getCheckInfoByUrl(@RequestBody UrlPO po) {
        return imageService.getCheckInfoByUrl(po);
    }

    @PostMapping("/getCheckInfoByFile")
    public Object getCheckInfoByFile(@RequestParam("image") MultipartFile image) {
        return imageService.getCheckInfoByFile(image);
    }

}
